#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;

void moveZero(vector<int>& nums)
{
    int cur = 0; int dest = -1;
    while (cur < nums.size())
    {
        if (nums[cur] == 0)  cur++;
        if (nums[cur] != 0)
        {
            swap(nums[dest + 1], nums[cur]);
            dest++; cur++;
        }
    }
}


int main()
{
    vector<int> v{0, 1, 0, 3, 12};
    moveZero(v);
    for (auto& e : v)
        cout << e << " ";
    cout << endl;
	return 0;
}